﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using WXYW.BLL;

namespace WXYW
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            InitializeHeadersBackground();
            if (!IsPostBack)
            {
                SetActiveHeaderBackground(BXZCLnkBtn);
            }
        }

        protected void BXZCLnkBtn_Click(object sender, EventArgs e)
        {
            ContentMultiView.ActiveViewIndex = 0;
            SetActiveHeaderBackground((LinkButton)sender);
        }

        protected void DOAZCLnkBtn_Click(object sender, EventArgs e)
        {
            ContentMultiView.ActiveViewIndex = 1;
            SetActiveHeaderBackground((LinkButton)sender);
        }

        protected void BJXXZCLnkBtn_Click(object sender, EventArgs e)
        {
            ContentMultiView.ActiveViewIndex = 2;
            SetActiveHeaderBackground((LinkButton)sender);
        }

        protected void NoRepairZCLnkBtn_Click(object sender, EventArgs e)
        {
            ContentMultiView.ActiveViewIndex = 3;
            SetActiveHeaderBackground((LinkButton)sender);
        }

        protected void SXLCLnkBtn_Click(object sender, EventArgs e)
        {
            ContentMultiView.ActiveViewIndex = 4;
            SetActiveHeaderBackground((LinkButton)sender);
        }

        protected void XXTXLnkBtn_Click(object sender, EventArgs e)
        {
            ServiceStationService service = new ServiceStationService();
            StationGridView.DataSource = service.GetALLServiceStations();
            StationGridView.DataBind();

            ContentMultiView.ActiveViewIndex = 5;
            SetActiveHeaderBackground((LinkButton)sender);
        }

        private void InitializeHeadersBackground()
        {
            //BXZCLnkBtn.BackColor = Color.FromName("#000000");
            //BJXXZCLnkBtn.BackColor = Color.FromName("#000000");
            //DOAZCLnkBtn.BackColor = Color.FromName("#000000");
            //BJXXZCLnkBtn.BackColor = Color.FromName("#000000");
            //NoRepairZCLnkBtn.BackColor = Color.FromName("#000000");
            //SXLCLnkBtn.BackColor = Color.FromName("#000000");
            //XXTXLnkBtn.BackColor = Color.FromName("#000000");

            BXZCLnkBtn.CssClass = "grad-box";
            BJXXZCLnkBtn.CssClass = "grad-box";
            DOAZCLnkBtn.CssClass = "grad-box";
            BJXXZCLnkBtn.CssClass = "grad-box";
            NoRepairZCLnkBtn.CssClass = "grad-box";
            SXLCLnkBtn.CssClass = "grad-box";
            XXTXLnkBtn.CssClass = "grad-box";
        }

        private void SetActiveHeaderBackground(LinkButton activeLnkBtn)
        {
            //activeLnkBtn.BackColor = Color.FromName("#FFFFFF");
            activeLnkBtn.CssClass = "current";
        }
    }
}
